package com.bjsxt.date;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class test {
    public static void main(String[] args) throws ParseException {
        long a= Long.MAX_VALUE/(1000L*3600*24*365);
        System.out.println(a);

        System.out.println(System.currentTimeMillis());

        Date d1 = new Date();
        System.out.println(d1);
        System.out.println(d1.getTime());

        Date d2 = new Date(1000L*3600*365*24*250);
        System.out.println(d2);

        SimpleDateFormat s1 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        SimpleDateFormat s2 = new SimpleDateFormat("yyyy_MM_dd");

        Date daytime =s1.parse("1979-4-10 10:49:57");
        System.out.println(daytime.getTime());

        Date daytome1= new Date(1000L*3600*23);
        String str = s2.format(daytome1);
        System.out.println(str);
        DateFormat df2 =new SimpleDateFormat("w_D_E");
        System.out.println(df2.format(System.currentTimeMillis()));
        //
        GregorianCalendar calendar = new GregorianCalendar(2999,10,4,10,23,56);
        System.out.println(calendar.get(Calendar.YEAR));
        System.out.println(calendar.get(Calendar.MONTH));
        System.out.println(calendar.get(Calendar.DAY_OF_WEEK));

        GregorianCalendar calendar1 = new GregorianCalendar();
        calendar1.set(Calendar.YEAR, 1029);
        GregorianCalendar calendar2 = new GregorianCalendar(2999,10,4,10,23,56);
        calendar2.add(Calendar.MONTH,-7);
        calendar2.add(Calendar.DATE,7);

        Date d= calendar2.getTime();
        GregorianCalendar calendar3=new GregorianCalendar();
        calendar3.setTime(d);
        System.out.println(calendar3);



    }
}
